package com.zhourong.mongodb.model;

import java.io.Serializable;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

@Document(collection = "user")
public class User implements Serializable , Comparable<User> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	private Integer userId;
	@Field("userName")
	private String userName;

	public User() {
		
	}
	
	public User(Integer userId) {
		this.userId = userId;
	}
	
	public User(Integer userId,String userName) {
		this.userId = userId;
		this.userName = userName;
	}
	
	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Override
	public int compareTo(User o) {
		return this.getUserId().compareTo(o.getUserId());
	}

	@Override
	public String toString() {
		return "User [userId=" + userId + ", userName=" + userName + "]";
	}
	
	

}
